package com.zjeav.lingjiao.ui.personCenter;

import com.zjeav.lingjiao.base.baseBean.Result;
import com.zjeav.lingjiao.base.request.ChangePwRequest;
import com.zjeav.lingjiao.base.request.RegisterRequest;
import com.zjeav.lingjiao.base.request.ValidateCode;
import com.zjeav.lingjiao.base.response.ValidateCodeResponse;
import com.zjeav.lingjiao.ui.register.RegisterView;

public class ModifyPasswordPresenter implements ModifyPasswordMoudle.OnCodeListener{

    ModifyPasswordMoudle modifyPasswordMoudle;
    RegisterView view;

    public ModifyPasswordPresenter(RegisterView view) {
        this.modifyPasswordMoudle = new ModifyPasswordMoudle();
        this.view = view;
    }

    public void getCode(ValidateCode phone) {
        this.modifyPasswordMoudle.getCode(phone, this);
    }
    public void register(ChangePwRequest resquest){
        this.modifyPasswordMoudle.register(resquest,this);
    }

    @Override
    public void OnSuccess(ValidateCodeResponse result) {
        view.showCodeSuccess(result);
    }

    @Override
    public void OnFailure(Throwable throwable) {
        view.showCodeFail();
    }

    @Override
    public void ChanagePasswordSuccess(Result result) {
        view.registerSuccess(result);
    }

    @Override
    public void ChanagePasswordFail(Throwable throwable) {

    }
}
